package com.neusmart.tongrentang.constants;

/**
 * 性别枚举
 * <p/>
 * roy
 */
public enum Gender {

    UNDEFINED("未知", 0),
    MALE("男", 1),
    FEMALE("女", 2),
    //
    ;

    String name;
    int value;

    Gender(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public static String getNameByValue(int value) {
        for (Gender gender : Gender.values()) {
            if (gender.getValue() == value) {
                return gender.getName();
            }
        }
        return UNDEFINED.getName();
    }
}
